package com.taotao.controller;

import com.taotao.utils.RemortIP;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author wangjin
 * @title: IndexController
 * @projectName sw-gateway
 * @description:
 * @date 2021/12/2 22:45
 */
@RestController
public class IndexController {
    @Value("${server.port}")
    private String serverport;

    @RequestMapping("/index")
    public String index(int i) {
        int b = 1 / i;

        return "index" + serverport;
    }


    @RequestMapping("/getMember")
    public String getMember(HttpServletRequest request) {
        String xRealIp = request.getHeader("X-Real-IP");
        String gatewayPort = request.getHeader("gateway.port");
        return "我是会员服务接口...端口：" + serverport + ",请求IP来源：" + xRealIp + ",转发端口来自：" + gatewayPort;
    }


}
